package pac;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

public class saveScreen extends JFrame {
	
	private JPanel contentPane;
	private JTextField userNameBox;
	String userName;

	
	public saveScreen(){
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 270, 196);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		JLabel lblStockTicker = new JLabel("Folio Name:");
		lblStockTicker.setBounds(10, 24, 156, 14);
		contentPane.add(lblStockTicker);

		userNameBox = new JTextField();
		userNameBox.setBounds(129, 21, 115, 20);
		contentPane.add(userNameBox);
		userNameBox.setColumns(10);
		
		JButton btnAdd = new JButton("Save Name");

		
		btnAdd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String userN = userNameBox.getText();
				returnFile(userN); 
				close();
			}
		});
		
		btnAdd.setBounds(20, 83, 89, 23);

		contentPane.add(btnAdd);
		
	}
	
	public String returnFile(String fileName){
		String fileName1;
		
		fileName1 = fileName + ".txt";
		
		return fileName1;
	}
	
	public void close(){
		this.dispose();
	}

}
